package Collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class CollectionDemo2 {
    public static void main(String[] args) {
        Collection<String>c = new ArrayList<>();
        c.add("a");
        c.add("b");
        c.add("b");
        c.add("d");
        c.add("e");
        Iterator<String>it =c.iterator();
        while (it.hasNext()){
            String s = it.next();
            if ("b".equals(s)){
                //指向那个，删除谁.
                it.remove();
            }
        }
        System.out.println(c);
    }
}
